"""
This script contained R programming codes

Purpose: To Conduct the Non-parametric (Wald–Wolfowitz) Runs test. The Runs test (a kind of non-parametric statistical significance test) calculates the significance level (p-value) of a small scale dataset which are not the in Gaussian normal distribution. 

Author : H. Lin, Ph.D., https://orcid.org/0000-0003-4060-7336 

Version: Created on 15th Feb. 2021, and updated on 18th Aug. 2025 (Lastest)
 

Below was a set of example numeric data to be tested:
"""
rnd33 <-c(0.7984375, 0.26640625, 0.82921875, 
          0.9259375, 0.84546875, 0.15609375, 
          0.13234375, 0.494375, 0.5228125, 
          0.78515625, 0.26109375, 0.45890625, 
          0.02046875, 
          0.58421875, 
          0.975625, 
          0.01734375, 
          0.4690625, 
          0.4609375, 
          0.14390625, 
          0.973125, 
          0.300625, 
          0.1771875, 
          0.96578125, 
          0.28203125, 
          0.75578125, 
          0.5603125, 
          0.71078125, 
          0.59578125, 
          0.05984375, 
          0.29765625, 
          0.88, 
          0.0190625, 
          0.92234375 # the last value, the 33 th.
          )

# package installation
install.packages("lawstat")


# package loading
library(lawstat)


# call the test function
runs.test(rnd33, plot.it = T) 


""" Results of Above Test

==================== Results of Above Test =====================
> runs.test(rnd33, plot.it = T)
	Runs Test - Two sided

data:  rnd33
Standardized Runs Statistic = -0.17167, p-value = 0.8637
================================================================


Result interpretation: the P-value = 0.86 > 0.05 (not significant), which indicated that, the dataset was likely to be generated randomly. 
"""



